package com.example.demo.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;

@Service
public class BedroomService {
    /**
     * 卧室灯光功能类*/

    // 获取日志对象
    private static final Logger logger = LoggerFactory.getLogger(BedroomService.class);

    // 开灯
    public void onLight() {
        System.out.println("卧室开灯");
    }

    // 关灯
    public void offLight() {
        System.out.println("卧室关灯");
    }

    // 打印日志
    @PostConstruct
    public void logging() {
        logger.trace("-- Service trace级别日志打印 --");
    }
}
